
package com.saohuobang.test.model.core;

import java.io.Serializable;

/**
 * 作者 yaohua.liu
 * 日期 2015-12-08 17:35
 * 说明 .自定义异常
 */
public class SystemException extends Exception implements Serializable {
    int code = -1;
    String errorMsg = "";
    String desc = "";
    Throwable e = null;

    public SystemException() {
    }

    public SystemException(String errorMsg) {
        this.errorMsg = errorMsg;
    }

    public SystemException(int code, String errorMsg) {
        this.code = code;
        this.errorMsg = errorMsg;
    }

    public SystemException(int code, String errorMsg, String desc) {
        this.code = code;
        this.errorMsg = errorMsg;
        this.desc = desc;
    }

    public SystemException(int code, String errorMsg, Throwable e) {
        this.code = code;
        this.errorMsg = errorMsg;
        this.e = e;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getErrorMsg() {
        return errorMsg;
    }

    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public Throwable getE() {
        return e;
    }

    public void setE(Throwable e) {
        this.e = e;
    }
    @Override
    public String getMessage(){
        return errorMsg;
    }
    @Override
    public String toString() {
        return "SystemException{" +
                "code=" + code +
                ", errorMsg='" + errorMsg + '\'' +
                ", desc='" + desc + '\'' +
                ", e=" + e +
                '}';
    }
}
